<?php

class language_phrase extends Model {

	public $table = 'phrases';
	
	public static function get($phrase, $module = '', $language = LANGUAGE)
	{
		if($module == '')
			$query = new Query("SELECT * FROM `phrases` WHERE `name` = ? AND `language` = ?", $phrase, $language);
		else
			$query = new Query("SELECT * FROM `phrases` WHERE `name` = ? AND `module` = ? AND `language` = ?", $phrase, $module, $language);
			
		if($query->num_rows() > 0)
		{
			$p = $query->fetch_assoc();
		
			return $p['phrase'];
		}
		else
		{
			return $phrase;
		}
		
		
	}
}
?>